﻿using System;
using System.Windows.Forms;
using Report.Properties;

namespace Report.UI
{
    public partial class SettingForm : Form
    {
        public SettingForm()
        {
            InitializeComponent();
        }

        private void SettingFormLoad(object sender, EventArgs e)
        {
            BindSettings();
        }

        private void BindSettings()
        {
            toolbarCheckBox.Checked = Settings.Default.ToolBar;
            autoOpenCheckBox.Checked = Settings.Default.AutoOpen;
            useTextBox.Text = Settings.Default.User;
        }

        private void ToolbarCheckBoxCheckedChanged(object sender, EventArgs e)
        {
            Settings.Default.ToolBar = toolbarCheckBox.Checked;
        }

        private void AutoOpenCheckBoxCheckedChanged(object sender, EventArgs e)
        {
            Settings.Default.AutoOpen = autoOpenCheckBox.Checked;
        }

        private void UseTextBoxTextChanged(object sender, EventArgs e)
        {
            Settings.Default.User = useTextBox.Text;
        }

        private void SettingFormFormClosing(object sender, FormClosingEventArgs e)
        {
            Settings.Default.Save();
        }
    }
}
